package com.bawei.movie.adapter

import androidx.recyclerview.widget.DiffUtil
import com.bawei.common.entity.MovieVideoEntity

/**
 * 数据实体对比对象
 */
object MovieEntityComparator : DiffUtil.ItemCallback<MovieVideoEntity>() {

    override fun areItemsTheSame(oldItem: MovieVideoEntity, newItem: MovieVideoEntity): Boolean = oldItem.id == newItem.id  //通过ID判断是否是同一个实体

    override fun areContentsTheSame(oldItem: MovieVideoEntity, newItem: MovieVideoEntity): Boolean = oldItem == newItem //通过对比实体内容判断是否为同一实体


}